<% if always_show_create %>
  ActiveScaffold.reset_form('<%= form_selector %>');
<% elsif params[:dont_close] %>
  ActiveScaffold.replace('<%= form_selector %>','<%= escape_javascript(render('create_form', xhr: true)) %>');
  ActiveScaffold.focus_first_element_of_form('<%= form_selector %>');
<% else %>
  if (action_link) action_link.close();
<% end %>
<% if active_scaffold_config.create.action_after_create %>
  var link = ActiveScaffold.find_action_link('<%= action_link_id active_scaffold_config.create.action_after_create, @record.id || @saved_record.id %>');
  if (link) link.open();
<% end %>
